<?php
//
ob_start();
session_start();

include "checksession.php";
$id_member = $_SESSION["id_member"];
include_once ("../connect.php");

$strSQL = "SELECT * FROM employee
                    JOIN depart ON employee.de_id = depart.id
                    JOIN mail  ON employee.emp_id = mail.emp_id
           WHERE employee.emp_id = '$id_member'
                                            ";
$objQuery = mysql_query($strSQL);
$objResult = mysql_fetch_array($objQuery);
?>

<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>Adinop Co., Ltd. was founded as an ingredients importer and local manufacturers’ distributor in 1986. We also function as an exporter of finished products</title>
        <link rel="stylesheet" href="../css/style.css"/>
    </head>
    <body class="body">           
        <?
      
        ob_start();
        $txtGrpId = $_GET["grpId"];

        include_once '../connect.php';
        $strSQL2 = "SELECT * FROM  graphic

                                                   WHERE  grpId = $txtGrpId
                            ";
        $objQuery2 = mysql_query($strSQL2) or die("Error Query [" . $strSQL2 . "]");
        $Num_Rows = mysql_num_rows($objQuery2);
        $n = 1;
        $Per_Page = 2;   // Per Page

        $Page = $_GET["Page"];
        if (!$_GET["Page"]) {
            $Page = 1;
        }

        $Prev_Page = $Page - 1;
        $Next_Page = $Page + 1;

        $Page_Start = (($Per_Page * $Page) - $Per_Page);
        if ($Num_Rows <= $Per_Page) {
            $Num_Pages = 1;
        } else if (($Num_Rows % $Per_Page) == 0) {
            $Num_Pages = ($Num_Rows / $Per_Page);
        } else {
            $Num_Pages = ($Num_Rows / $Per_Page) + 1;
            $Num_Pages = (int) $Num_Pages;
        }

        $strSQL2 .=" order  by grpReuiDate ASC LIMIT $Page_Start , $Per_Page";
        $objQuery2 = mysql_query($strSQL2);
        ?>
        </div>
        <div class="nameTitle">ตัวอย่าง รายการขอออกแบบงานกราฟิค</div>
        <table width="100%"  border="0" align="center" cellpadding="1" cellspacing="0" class="simply">
            <?
            while ($objResult2 = mysql_fetch_array($objQuery2)) {
                ?>
                <tbody>
                    <tr>                                                   
                        <td width="100%">                          
                            <a href="../upload/<?php echo $objResult2["grpExample"];?>"><?php echo $objResult2["grpExample"];?>
                        </td>                                                                                                                            
                    </tr>
                    <?
                }
                ?>
            </tbody>
        </table>
        <table width="100%"  border="0" align="center" cellpadding="1" cellspacing="0" class="simply">
            <tr>
                <td>
                    <br>
                        Total <?= $Num_Rows; ?> Record : <?= $Num_Pages; ?> Page :
                        <?
                        if ($Prev_Page) {
                            echo " <a href='$_SERVER[SCRIPT_NAME]?Page=$Prev_Page'><< Back</a> ";
                        }

                        for ($i = 1; $i <= $Num_Pages; $i++) {
                            if ($i != $Page) {
                                echo "[ <a href='$_SERVER[SCRIPT_NAME]?Page=$i'>$i</a> ]";
                            } else {
                                echo "<b> $i </b>";
                            }
                        }
                        if ($Page != $Num_Pages) {
                            echo " <a href ='$_SERVER[SCRIPT_NAME]?Page=$Next_Page'>Next>></a> ";
                        }
                        ?>
                </td>
            </tr>
        </table>
        </td>
        </tr>  
        <tr>
            <td colspan="2">
                <div><a href="../checklogout.php" onclick="return confirm('what do you want Exit')"> <img src="../images/logout.png" width="150px"></img></a></div>
            </td>
        </tr>
        <tr>
            <td class="footer" colspan="2">
                Powered by Department Technology information Adinop
            </td>
        </tr>
        </table>
    </body>
</html>